package router

import (
	"ginstudydemo.com/main/controllers"
	"ginstudydemo.com/main/middleware"
	"github.com/gin-gonic/gin"
)

// MenusRouter 函数定义了 菜单 路由组及其处理函数
func MenusRouter(r *gin.Engine) {
	rGroup := r.Group("/menus")
	{
		// 菜单路由列表
		rGroup.GET("/routes", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().GetMenusRoutes)

		// 菜单路由列表
		rGroup.GET("", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().GetMenus)

		// 菜单下拉列表
		rGroup.GET("/options", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().GetMenusOptions)

		// 菜单表单数据
		rGroup.GET("/:id/form", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().GetMenusForm)

		// 新增菜单
		rGroup.POST("", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().AddMenus)

		// 修改菜单
		rGroup.PUT("/:id", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().EditMenus)

		// 删除菜单
		//rGroup.DELETE("/:ids", middleware.NewJwtV5().JWTAuth(), controllers.NewMenusController().DelMenus)

	}

}
